//==================================================================
/// PlayerCar.h
///
/// Created by Davide Pasca - 2010/3/30
/// See the file "license.txt" that comes with this project for
/// copyright info. 
//==================================================================

#ifndef PLAYERCAR_H
#define PLAYERCAR_H

//==================================================================
class vehicle;

//==================================================================
class PlayerCar
{
public:
	static const int	WHEEL_MAX=32, WHEEL_MIN=-32;
	int					mWheelPos;

	int					mDriftVal;
	bool				mIsNoseDiving;

	float				mSpeed;
	float				mAccel;

	int					mRendFrame;

	//==================================================================
	class AnimParams
	{
	public:
		bool	mLeftIsDown;
		bool	mRightIsDown;
		bool	mUpIsDown;
		bool	mDownIsDown;
		float	mCurXAcc;	
		const vehicle	*mpCollVehicle;
		float	mCollVehicleStrength;
		int		mEdgeCollisionVal;
	};

public:
	PlayerCar()
	{
		mWheelPos = 0;
		mDriftVal = 0;
		mIsNoseDiving	= false;

		mSpeed	= 0;
		mAccel	= 0;

		mRendFrame = 0;
	}

	void Animate(
				const AnimParams &par,
				float &out_carXAccel,
				float &out_roadXAccel );

	void Draw(
				graphics			&g,
				const transformer	&xformer,
				particler			&smokeLPart,
				particler			&smokeRPart,
				sprite				&smokeSptr,
				sprite				&myCarSptr,
				const Vec3			&myCarPosCS
				);
};

#endif